GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 043e72...5d2753 )
by Benjamin
06:48 queued 02:54
created

setTreeValue.test.js ➔ ???   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 97

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 97
rs 8.3604
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
/* eslint-enable describe it sinon */
2
import expect from 'expect';
3
4
import {
5
    setTreeValue
6
} from './../../src/util/setTreeValue';
7
8
describe('the setTreeValue utility', () => {
9
10
    it('Should turn a tree into a flat list with no identifier', () => {
11
12
        const data = {
13
            root: {
14
                id: -1,
15
                children: [
16
                    {
17
                        id: 1,
18
                        parentId: -1,
19
                        children: [
20
                            {
21
                                id: 11,
22
                                parentId: 1
23
                            },
24
                            {
25
                                id: 12,
26
                                parentId: 1,
27
                                children: [
28
                                    {
29
                                        id: 121,
30
                                        parentId: 12,
31
                                        children: [
32
                                            {
33
                                                id: 1211,
34
                                                parentId: 121
35
                                            }
36
                                        ]
37
                                    }
38
                                ]
39
                            }
40
                        ]
41
                    },
42
                    {
43
                        id: 2,
44
                        parentId: -1,
45
                        children: [
46
                            {
47
                                id: 21,
48
                                parentId: 2
49
                            }
50
                        ]
51
                    }
52
                ]
53
            }
54
        };
55
56
        expect(
57
            setTreeValue(data, [-1, 1, 12, 121], { _hideChildren: true })
58
        ).toEqual({
59
            root: {
60
                id: -1,
61
                children: [
62
                    {
63
                        id: 1,
64
                        parentId: -1,
65
                        children: [
66
                            {
67
                                id: 11,
68
                                parentId: 1
69
                            },
70
                            {
71
                                id: 12,
72
                                parentId: 1,
73
                                children: [
74
                                    {
75
                                        id: 121,
76
                                        _hideChildren: true,
77
                                        parentId: 12,
78
                                        children: [
79
                                            {
80
                                                id: 1211,
81
                                                parentId: 121
82
                                            }
83
                                        ]
84
                                    }
85
                                ]
86
                            }
87
                        ]
88
                    },
89
                    {
90
                        id: 2,
91
                        parentId: -1,
92
                        children: [
93
                            {
94
                                id: 21,
95
                                parentId: 2
96
                            }
97
                        ]
98
                    }
99
                ]
100
            }
101
        });
102
    });
103
104
});
105